<template>
  <div id="app">
    <!-- vue-touch提供的滑动事件指令，可以参考vue-touch文档 -->
    <vue-touch v-on:swipeleft="onSwipeLeft" v-on:swiperight="onSwipeRight">
        <router-view></router-view>
    </vue-touch>
  </div>
</template>

<script>
export default {
  name: 'App',
  methods: {
    onSwipeLeft() {
        	// router转场后会自动触发vueg的转场特效
        switch (this.$route.name) {
           	case 'default':
            case 'seismicinfo':
            	this.$router.push({
                    name: 'weatherinfo'
                })
            	break
            case 'weatherinfo':
                this.$router.push({
                    name: 'populationinfo'
                })
                break
            case 'populationinfo':
                this.$router.push({
                    name: 'economicinfo'
                })
                break
            case 'economicinfo':
            	this.$router.push({
                    name: 'environmeninfo'
                })
            	break
            case 'environmeninfo':
                this.$router.push({
                    name: 'thd'
                })
                break
            case 'thd':
                this.$router.push({
                    name: 'nearfz'
                })
                break
            case 'nearfz':
                this.$router.push({
                    name: 'seismicinfo'
                })
                break
            }
        },
    onSwipeRight() {
        switch (this.$route.name) {
            case 'default':
            case 'seismicinfo':
                this.$router.push({
                    name: 'nearfz'
                })
                break
            case 'weatherinfo':
                this.$router.push({
                    name: 'seismicinfo'
                })
                break
            case 'populationinfo':
                this.$router.push({
                    name: 'weatherinfo'
                })
                break
            case 'economicinfo':
                this.$router.push({
                    name: 'populationinfo'
                })
                break
            case 'environmeninfo':
                this.$router.push({
                    name: 'economicinfo'
                })
                break
            case 'thd':
                this.$router.push({
                    name: 'environmeninfo'
                })
                break
            case 'nearfz':
                this.$router.push({
                    name: 'thd'
                })
                break
            }
        }
    }
}
</script>

<style>
html,
body
{
    margin: 0;
    height: 100%;
}
div {
    background-color: #fff; 
}
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
}
#app > div {
    height: 100%;
}
.home-container {
    height: 100%; 
}
.content-container {
    height: 100%;
    overflow-x: hidden;
    text-align: center;
    background-color: #f7f4f4;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch
}
.map-container{
   height:calc(100% - 4rem);
   position: relative;
}
@media only screen and (max-width: 377px) {
    .map-container {
      height: calc(100% - 4rem);
    }
}
@media only screen and (max-width: 320px) {
    .map-container {
      height:calc(100% - 4rem);
    }
}
.map-container div,.thd-map div{
  background-color: transparent; 
}
</style>
